package com.juefeng.common;

import org.apache.log4j.PropertyConfigurator;

/**
 * �������:com.igame.app.base.Log4jConfig
 * 
 * <pre>
 * ����: ��־���Զ�����
 * ��д��:ouyang
 * ��Ȩ: Copyright (C) 2012  www.3yx.com
 * ����ʱ��: 2012-2-6
 * </pre>
 */
public class Log4jConfig {
	private static boolean isReload = true;

	private static void load() {
		String path = Log4jConfig.class.getClass().getResource("/").getPath() + "log.properties";
		System.out.println("log4j configfile path=" + path);
		// PropertyConfigurator.configureAndWatch(path,1000*60*60*24);// ����ض�ʱ�䣬����ļ��Ƿ��޸ģ��Զ����¶�ȡ����
		PropertyConfigurator.configure(path);
	}
	/**
	 * ����ָ��·������־�ļ�
	 * @author ouyang ����ʱ�䣺Apr 24, 2012 5:59:05 PM
	 */
	private static void load(String filePath) {
		String path = Log4jConfig.class.getClass().getResource("/").getPath() + filePath;
		System.out.println("log4j configfile path=" + path);
		PropertyConfigurator.configure(path);
	}

	public static void reload() {
		if (isReload) {
			load();
		}
		isReload = false;
	}

	public void setReload(boolean flag) {
		isReload = flag;
	}

}
